import type { OrderParams } from '@/types/consult'
import type { Evaluatedoctors, PatientItem, PatientParams } from '@/types/patient'
import { request } from '@/utils/http'

/**
 * 添加患者（家庭档案）
 */
export const addPatientApi = (data: PatientParams) => {
  return request.post('/patient/add', data)
}

/**
 * 获取患者（家庭档案）列表
 */
export const patientListApi = () => {
  return request.get<null, PatientItem[]>('/patient/mylist')
}

/**
 * 删除患者（家庭档案）
 */
export const delPatientApi = (id: string) => {
  return request.delete(`/patient/del/${id}`)
}

/**
 * 问诊-查询患者详情
 * @param id 患者id
 * @returns
 */
export const patientDetailApi = (id: string) => {
  return request.get<null, PatientItem>(`/patient/info/${id}`)
}

/**
 * 问诊-编辑患者信息
 * @param data
 * @returns
 */
export const updatePatientApi = (data: PatientParams) => {
  return request.put(`/patient/update`, data)
}

/**
 * 问诊-保存/修改问诊订单(创建订单 -> 返回订单id -> 支付)
 */
export const createOrderApi = (data: OrderParams) => {
  return request.post<null, { id: string }>('/patient/consult/order', data)
}

// 问诊-订单-评价医生
// POST
// /patient/order/evaluate
export const evaluateDoctorApi = (data: Evaluatedoctors) => {
  return request.post('/patient/order/evaluate', data)
}
